var TrajectoryService = Backbone.Model.extend({
	datasource:null,
	shop:null,
	initialize: function(args,options){
		_.extend(this,options);
	},
	search:function(attr,callback){
		this.url = this.datasource + "/" + this.shop + "/trajectory/query/" + attr.trajectory + "/" + attr.from + "/" + attr.to; 
		this.fetch({success:callback},{});
	},
	loadLines:function(callback){
		this.url = this.datasource + "/" + this.shop + "/trajectory/query/lines";
		this.fetch({success:function(model, response){
			var template = _.template($("#template-lines").html())({
	            lines: response
	        });
			$("#line_selector").html(template);		
			$("#lines option").each(function(){
				if(_.indexOf(Settings.line , this.value) >= 0)
					$(this).attr("selected","selected");
			});
			$("#lines").multiselect();
			model.clear();
			callback();
		}},{});
	}
});